function getDeepth(arr) {
    let deepth = Array.isArray(arr) ? 1 : 0;
    if (Array.isArray(arr)) {
        const itemDeepth = arr.map(item => getDeepth(item));
        const childDeepth = Math.max(...itemDeepth);
        deepth += childDeepth;
    }
    return deepth;
}


const arr = [[2, [3, 4, [5, [6, 7, [8]]]]], 1, [2, [3, 4, [5, [6, 7, [8]]]]]];

const d = getDeepth(arr);
console.log(d);